Allow to invoke Cargo commands with empty features
authorValerii Hiora <valerii.hiora@gmail.com>
Wed, 8 Oct 2014 05:54:16 +0000 (08:54 +0300)
committerValerii Hiora <valerii.hiora@gmail.com>
Thu, 9 Oct 2014 19:04:53 +0000 (22:04 +0300)
commite53e981d899e6a2d60ffb35cfa526ac1fc4d51cd
treee19c52853605e09953b11cbe39e327afc6669294
parentcedecb3753da91a604ec666fffa61bac27117677
Allow to invoke Cargo commands with empty features

For automation it should be no difference between invocations
of `--features "feat1 feat2 feat3"` and `--features ""`.

The problem is that in the latter case `docopt` sets flag_feature to vec![""]

Could be solved on 3 different levels:

- patching `docopt` to treat empty string for a Vec<String> flag
  as empty vec. Although I can't imagine that in some place it
  might be required to treat empty string as vector of empty
  strings it is might have its own use.

- filtering flags_feature right after parsing command line and
  before passing further. It means it should be fixed in at
  least 4 different places now and may be forgotten in future.

- filtering empty string feature while resolving - perhaps
  the easiest and more universal solution, implemented in this
  patch.
src/cargo/core/resolver.rs
tests/test_cargo_features.rs